package com.wms.service.impl;

import com.wms.mapper.UserMapper;
import com.wms.pojo.User;
import com.wms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description:
 * @Project:
 * @CreateDate: Created in 2020/3/17 20:20
 * @Author: YXH
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public User queryUserByName(String name) {
        return userMapper.queryUserByName(name);
    }

    @Override
    public List<User> allAdmin() {
        return userMapper.allAdmin();
    }

    @Override
    public User queryById(int id) {
        return userMapper.queryById(id);
    }

    @Override
    public void setStatus(int id, int status) {
        userMapper.setStatus(id,status);
    }

    @Override
    public void addAdmin(User user) {
        user.setStatus(0);
        userMapper.addAdmin(user);
    }

    @Override
    public void editAdmin(User user) {
        userMapper.updateAdmin(user);
    }

    @Override
    public void delAdmin(int id) {
        userMapper.delAdmin(id);
    }
}
